PyChelator: a Python-based Colab and web application for metal chelator calculations

Background Metal ions play vital roles in regulating various biological systems, making it essential to control the concentration of free metal ions in solutions during experimental procedures. Several software applications exist for estimating the concentration of free metals in the presence of chelators, with MaxChelator being the easily accessible choice in this domain. This work aimed at developing a Python version of the software with arbitrary precision calculations, extensive new features, and a user-friendly interface to calculate the free metal ions. Results We introduce the open-source PyChelator web application and the Python-based Google Colaboratory notebook, PyChelator Colab. Key features aim to improve the user experience of metal chelator calculations including input in smaller units, selection among stability constants, input of user-defined constants, and convenient download of all results in Excel format. These features were implemented in Python language by employing Google Colab, facilitating the incorporation of the calculator into other Python-based pipelines and inviting the contributions from the community of Python-using scientists for further enhancements. Arbitrary-precision arithmetic was employed by using the built-in Decimal module to obtain the most accurate results and to avoid rounding errors. No notable differences were observed compared to the results obtained from the PyChelator web application. However, comparison of different sources of stability constants showed substantial differences among them. Conclusions PyChelator is a user-friendly metal and chelator calculator that provides a platform for further development. It is provided as an interactive web application, freely available for use at https://amrutelab.github.io/PyChelator, and as a Python-based Google Colaboratory notebook at https://colab.research.google.com/github/AmruteLab/PyChelator/blob/main/PyChelator_Colab.ipynb. Supplementary Information The online version contains supplementary material available at 10.1186/s12859-024-05858-8.


Chemical equilibrium of metals and ligands.
The equilibrium between a metal (M) and ligand (L) is represented as: Stability constant K for the formation of the complex [ML] by the free metal concentration [M] and free ligand concentration [L] is given by the formula: (2) However, ligands (L) such as EGTA do not only bind to divalent metals, but also to hydrogen protons (H).The reactions below express this relationship, as given in the work by Smith and Miller [1]: K1 -K4 are the binding constants of hydrogen to the ligand; KCa1 and KCa2 represent the metal binding constants.
Calcium binds to L 4-and HL 3-forms of EGTA.If to the EGTA buffer having Calcium, another metal is also added (such as Magnesium), calculations involve solving for a cubic equation (for a sample schematic, see Appendix in [2]).Moreover, if another ligand is added, such as ATP, an iterative calculation must be used to solve for the systems of equations, involving an initial guess, iteration loop and convergence check, until the approximation reaches a certain threshold or the pre-set number of iterations are reached.Before the stability constants can be used in these calculations, they are corrected for ionic strength, temperature and pH.All the calculations are used from the well-established Maxchelator [3,4].The flow of the calculations together with the corresponding functions in the code is explained below.

The correction of equilibrium constants for ionic strength and temperature
Temperature correction of equilibrium constants is done based on the Van 't Hoff equation [5,6]: where, K' is the corrected equilibrium constant, ∆H is enthalpy of reaction in kcal/mol, T is the temperature in °K, R is the gas constant given by R = 1.9872 × 10 −3 /( • °).
Ionic strength correction of equilibrium constants is done using the following equation derived from the Debye-Hückel limiting law [1]: log 10  ′ = log 10  + 2 (log 10   − log 10  ′  ) (5) where, x and y represent the absolute value of charges of the cation and anion in the reaction, the term log 10   is the adjustment for activity coefficients at zero ionic strength and log 10 ′  at the desired ionic strength of ion .where,  is the dielectric constant of water, T is the absolute temperature.The constant A is calculated by substituting the  and the temperature, and used in the calculation of log 10   where b is a coefficient (0.25), and   is the ionic equivalent.Ionic equivalent was shown to better explain the empirical relationship of total ionic content to stoichiometric constants [1].
Here, ionic equivalent is used rather than the standard ionic strength, differing in magnitude only in polyvalent ions: where   is the concentration and   is the charge of the  th ion in the solution.

Figure S1 .
Figure S1.Diagram depicting the functions used in PyChelator.A) Flow of the setup() function.B) Sequence of calculations upon calling the docalc() function.Firstly, the function collectValues() retrieves the free or total metal values from the user input, followed by the function adjustConstantsForTemperatureAndIonicStrength(), which adjusts the constants based on the values for temperature and ionic strength (i.e.ionic equivalence) input by the user.Subsequent steps include the calculateHydrogenConcentration() function to calculate the concentration of hydrogen ions in the solution, and the convertExponentialToRealConstants() function to calculate various coefficients and sums based on provided constants and hydrogen ion concentration.Next, the function getCheckboxValues() gets all the checkbox values needed to modify the information outputted to the user.After calculateAndDisplayFreeMetals() or calculateAndDisplayTotalMetals() function is executed, calculateIonicContribution() function calculates the ionic contribution from metal-chelator complexes and free chelators.Finally, the function calculateChelatorConstants() calculates the metal chelation constants and generateResultArray() populates the variable result_array with all the necessary data to generate the file for the user.The function displayOutput() displays the results of the above algorithms.The functions taken from MaxChelator and improved are indicated with red color.The functions indicated with blue were added new.Other new functions that are not depicted in the flowchart are downloadOutput(), which downloads all results as one excel sheet, and calculateionicEquivalent(), which enables calculation and use of ionic equivalence inside PyChelator.